<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>个人中心——账户设置</title>
	<!-- Set render engine for 360 browser -->
		<meta name="renderer" content="webkit">
		<!-- No Baidu Siteapp-->
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<!-- Add to homescreen for Chrome on Android -->
		<meta name="mobile-web-app-capable" content="yes">
		<!-- Add to homescreen for Safari on iOS -->
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="__PUBLIC__/assets/css/amazeui.css">
		<link rel="stylesheet" href="__PUBLIC__/assets/css/app.css">
		<!--[if lt IE 9]>
		<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
		<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
		<script src="__PUBLIC__/assets/js/amazeui.ie8polyfill.min.js"></script>
		<![endif]-->
		<script type="text/javascript" src="__PUBLIC__/assets/js/jquery-1.9.1.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/assets/js/jquery.validate.js"></script>
		<script type="text/javascript" src="__PUBLIC__/assets/js/validate-ex.js"></script>
		<script src="__PUBLIC__/assets/js/amazeui.js"></script>
		<script type="text/javascript" src="__PUBLIC__/assets/js/app.js"></script>
		<script type="text/javascript" src="__PUBLIC__/assets/js/jump.js"></script>
		<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
		<script type="text/javascript" src="__PUBLIC__/js/duxui.js"></script>
		<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
		<!--鼠标经过导航跳动开始-->
		<!--<script type="text/javascript">
			$(function(){
				 $(".am-topbar-nav li").each(function(k,a){
					new JumpObj(a,5);//晃动幅度
					$(a).hover(function(){this.parentNode.parentNode.addClass("hover")});
				});
		 	}); 
		
		</script>-->
		<!--鼠标经过导航跳动结束-->
	</head>
	<body>	
    <!--#include file="head.html"-->
		<!--内容开始-->
         <!--#include file="left.html"-->
					<div class="am-u-lg-10" style="padding: 0;">
						<div class="right order_right">
							<div class="order_title" style="border-bottom: 1px solid #d7d6d6;">
								<p>资料设置</p>
							</div>
							<div class="right_content">
								<div class="am-u-md-2">
									<p>
										<img src="__PUBLIC__/assets/i/man.jpg" style="max-width: 104px;"/>
									</p>
								</div>
								<div class="am-u-md-10">	
									<table border="0" cellspacing="10" cellpadding="0">
										<tbody>
										<tr>
											<td style="height:30px;">
												<span class="uusername">昵称：</span>
											</td>
											<td id="oldnicknamebox" style="display: block; height:30px;">
													<span id="nickname" class="uusername"><?php echo $_SESSION['uuser']['nickname'];?></span>
													<a href="javascript:void(0);" class="orangeword" onclick="edit('nickname')">更改</a>
											</td>
											<td id="newnicknamebox" style="display: none; height:30px;">
													<input name="nwenickname" id="nwenickname" type="text" value="<?php echo $_SESSION['uuser']['nickname'];?>"></input>
													<a href="javascript:void(0);" class="orangeword" onclick="edit_save('nickname')" >确定</a>
											</td>
										</tr>
										<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
										<tr>
											<td>
												<span class="accountword">邮箱：</span>
											</td>
											<td>
												{$user_info.email}
											</td>
											<td>
												<a href="javascript:void(0);" class="orangeword">修改密码</a>
											</td>
										</tr>
										<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
										<tr>
											<td>
												<span class="accountword">手机：未绑定</span>
											</td>
											<td>
												<a href="__APP__/index/bind_phone" class="orangeword">绑定</a>
											</td>
										</tr>
										<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
										<tr>
											<td>
												
											</td>
											<td>
												
											</td>
										</tr>
										</tbody>
									</table>
									<br />
									<br />
									<table border="0" cellspacing="10" cellpadding="0">
										<tr>
											<td id="" style="height:30px;">
												<span class="accountword">性别：</span>
											</td>
											<td id="oldsexbox" style="display: block; height:30px;">
												<!--if:{$user_info['sex']==1}--> 
													男
													<!--{else}--> 
													女
		    										<!--/if--> 
												<a href="javascript:;" class="orangeword" onclick="edit('sex')">编辑</a>
											</td>
											<td id="newsexbox" style="display: none; height:30px;">
														<select class="list_ta" name="newsex" id="newsex" style="width: 150px;">
														<option value="1">男</option>
														<option value="2">女</option>
													</select>
													<a href="javascript:void(0);" class="orangeword"   onclick="edit_save('sex')" >确定</a>
											</td>
											<td id="new" style="display: none; height:30px;">
											</td>
										</tr>
										<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
										<tr>
											<td>
												<span class="accountword">生日：</span>
											</td>
											<td  id="oldbirthdaybox" style="display: block; height:30px;">
												<!--if:{!empty($user_info['birthda'])}--> 
													{$user_info.birthda}
													<!--{else}--> 
													未设置
		    										<!--/if-->
												<a href="javascript:;" class="orangeword" onclick="edit('birthday')">编辑</a>
											</td>
											<td id="newbirthdaybox" style="display: none; height:30px;">
												<input name="newbirthday"  id="newbirthday" type="text" 
													style="width: 150px;" class="text_value" value=""/>
												<a href="javascript:void(0);" class="orangeword"   onclick="edit_save('birthday')" >确定</a>
											</td>
										</tr>
										<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
										<tr>
											<td>
												<span class="accountword">所在地：</span>
											</td>
											<td>
												XX省&nbsp;&nbsp;XX市&nbsp;&nbsp;XX区
											<a href="javascript:;" class="orangeword" onclick="edit('area',this)">编辑</a>
											</td>
										</tr>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			
		</div>
	<script>
		function edit(etype) {
				document.getElementById("old"+etype+"box").style.display="none";
				document.getElementById("new"+etype+"box").style.display="block";
		}
		
		function edit_save(jian){
			var zhi;
				zhi=document.getElementById("nwe"+jian).value;
			var request = new XMLHttpRequest();
			request.open("POST", "__APP__/user/edit_save");
			var data = jian+"=" + zhi+"&type="+jian;
			request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			request.send(data);
			request.onreadystatechange = function() {
				if (request.readyState===4) {
					if (request.status===200) {
						
						if(request.responseText=="1"){
							document.getElementById(jian).innerHTML = zhi;
							document.getElementById("new"+jian+"box").value="";
							document.getElementById("new"+jian+"box").style.display="none";
							document.getElementById("old"+jian+"box").style.display="block";
						}
						else {
							/*document.getElementById("isexist").style.display="none";*/
							alert("修改失败！");
						}

					} else {
						alert("发生错误：" + request.status);
					}
				}
			}
		}

		
	</script>
	<script>
		//日期选择
		$('#newbirthday').calendar({
			id : '#newbirthday',
			format : 'yyyy/MM/dd'
		});
	</script>

			<!--底部导航开始-->
		<!--#include file="foot.html"-->
		<!--底部导航结束-->
	</body>
</html>
